package org.redis.cluster.transport;

public interface ByteBuffer {

	/**
	 * 数组
	 * @return
	 */
	public byte[] array();
	
	/**
	 * 跳过
	 * @param length
	 * @return
	 */
	public boolean skip(int length);
	
	/**
	 * 返回字节
	 * @param position
	 * @return
	 */
	public byte getByte(int position);
	
	/**
	 * 可读的字节
	 * @return
	 */
	public int readableBytes();
	
	/**
	 * 是否可读
	 * @return
	 */
	public boolean isReadable();
	
	/**
	 * 是否可读
	 * @param length
	 * @return
	 */
	public boolean isReadable(int length);

	/**
	 * 读
	 * @return
	 */
	public byte readByte();
	
	/**
	 * 读
	 * @param bytes
	 * @return
	 */
	public boolean readBytes(byte bytes[]);
	
	/**
	 * 指针
	 * @return
	 */
	public int position();

	/**
	 * 设置指针
	 * @param newPosition
	 * @return
	 */
	public boolean position(int newPosition);
}